<?php

use common\addons\diandi_shop\models\enums\GoodsStatus;
use yii2mod\editable\EditableColumn;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\modules\diandi_shop\models\searchs\DdShopCommentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '评论';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= $this->render('_tab'); ?>

<div class="firetech-main">

<div class="dd-shop-comment-index ">
    <?= $this->render('_search', ['model' => $searchModel]); ?>
    <div class="panel panel-default">
    <div class="panel-heading">
            <h3 class="panel-title">评论列表</h3>
      </div>
        <div class="box-body">
            <?= GridView::widget([
                'dataProvider' => $dataProvider,
                // 'filterModel' => $searchModel,
                'layout' => "{items}\n{pager}",
                'columns' => [
                    ['class' => 'yii\grid\SerialColumn'],

                    'id',
                    'user_id',
                    'comment',
                    'create_time:datetime',
                    [
                        'class' => EditableColumn::class,
                        'attribute' => 'status',
                        'value' => function ($model) {
                            return $model->status==0?'待审核':'已审核';
                        },
                        'url' => ['change-status'],
                        'type' => 'select',
                        'editableOptions' => function ($model) {
                            return [
                                'source' => ['待审核','已审核'],
                                'value' => $model->status==0?'待审核':'已审核',
                            ];
                        },
                    ],
                    //'star_level',

                    ['class' => 'common\components\ActionColumn'],
                ],
            ]); ?>


</div>
    </div>
</div>
</div>